namespace Core.Features
{
    using System;
    using Base;
    using Contracts.Enums;
    using Resources;

    
    public sealed class EnergyDrainerElectrostaticDispersion<T> : FeatureBase<object>
    {
        public EnergyDrainerElectrostaticDispersion(){}

        public EnergyDrainerElectrostaticDispersion(T value) 
            : base(value){ }

        /// <summary>
        /// Obtains the feature name
        /// </summary>
        public override string Name
        {
            get { return "Electrostatic dispersion"; }
        }

        /// <summary>
        /// Obtains the feature group
        /// </summary>
        public override FeatureGroupsEnum FeatureGroup { get { return FeatureGroupsEnum.Specific; } }
        /// <summary>
        /// Obtains the feature type
        /// </summary>
        public override FeaturesEnum FeatureType { get { return FeaturesEnum.EnergyDrainerElectrostaticDispersion; } }
        /// <summary>
        /// Obtains or defines the feature unit
        /// </summary>
        public override string Unit { get { return Traduction.label_unit_degree; } }

        public override void SetModifiedValue(Contracts.Interfaces.IAgent agent, Contracts.Interfaces.IRobot robot)
        {
            if (agent == null || robot == null) return;

            // Bonus from extensions
            var temp = (double)Value * (1 + agent.Extensions.SumModifiersValues(FeatureTypesEnum.Module, this.FeatureType));

            ModifiedValue = IsRounded
                ? Math.Round(temp, 0, MidpointRounding.AwayFromZero)
                : Math.Round(temp, 2);
        }
        
    }
}